# pylint: disable=C0103
from enum import Enum
from typing_extensions import Self


class Strength(int, Enum):

    Unset = -1
    Unmet = 0
    Supporting = 1
    Moderate = 2
    Strong = 3
    VeryStrong = 4

    def upgrade(self, level: int) -> Self:
        return Strength(min(self.value + level, 4))

    def downgrade(self, level: int) -> Self:
        return Strength(max(self.value - level, 0))


class LoF(str, Enum):
    FrameShift = "frameshift"
    Nonsense = "nonsense"
    Splicing = "splicing"
    StartLoss = "startloss"

    @classmethod
    def from_event(cls, event: str) -> Self | None:
        for lof in cls:
            if event.find(lof.value) != -1:
                return lof
        return None


class Criterion(str, Enum):
    PTEN = "PTEN"
    CDH1 = "CDH1"
    IC5 = "IC5"
    NF0 = "NF0"
    NF1 = "NF1"
    NF2 = "NF2"
    NF3 = "NF3"
    NF4 = "NF4"
    NF5 = "NF5"
    NF6 = "NF6"
    SS1 = "SS1"
    SS2 = "SS2"
    SS3 = "SS3"
    SS4 = "SS4"
    SS5 = "SS5"
    SS6 = "SS6"
    SS7 = "SS7"
    SS8 = "SS8"
    SS9 = "SS9"
    SS10 = "SS10"
    IC0 = "IC0"
    IC1 = "IC1"
    IC2 = "IC2"
    IC3 = "IC3"
    IC4 = "IC4"
